<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../js/vue.js"></script>
</head>

<body>
    <div id="app">
        {{people.name}}
        <input type="text" v-model="people.name">
    </div>
</body>
<script>
    var vm = new Vue({
        el: '#app',
        data: {
            msg: "hello vue",
            people: {
                name: "张三",
                age: 16
            }
        },
        methods: {},
        // watch: {
        //     // 'people': {
        //     //     handler: function (newValue, oldValue) {
        //     //         console.log(newValue.name + "   " + oldValue.name)
        //     //     },
        //     //     deep: true
        //     // }
        //     //单引号不可去除
        // }
    })
    vm.$watch('people', function (newValue, oldValue) {
        console.log(`${newValue}.name+"    "+${oldValue}.name`)
    }, {
        deep: true,
        immediate: true,
    });
</script>

</html>